]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ibusCandidatePopup: Add support for relative cursor positioning
authorRui Matos <tiagomatos@gmail.com>
Wed, 30 Jul 2014 12:40:39 +0000 (14:40 +0200)
committerRui Matos <tiagomatos@gmail.com>
Mon, 15 Feb 2016 17:06:53 +0000 (18:06 +0100)
IBus now provides a new method for cursor positioning where the
coordinates are relative to the focused window. This is useful for
wayland clients which don't have access to their global coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=753476

js/ui/ibusCandidatePopup.js

index 7ce66a04626836efbb8a1620ed70dddd2a4190b5..5aedc86893cc78e20bfd0a45128dc12d2e265d68 100644 (file)
@@ -158,9 +158,14 @@ const CandidatePopup = new Lang.Class({
 
         panelService.connect('set-cursor-location',
                              Lang.bind(this, function(ps, x, y, w, h) {
-                                 Main.layoutManager.setDummyCursorGeometry(x, y, w, h);
-                                 if (this._boxPointer.actor.visible)
-                                     this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
+                                 this._setDummyCursorGeometry(x, y, w, h);
+                             }));
+        panelService.connect('set-cursor-location-relative',
+                             Lang.bind(this, function(ps, x, y, w, h) {
+                                 if (!global.display.focus_window)
+                                     return;
+                                 let window = global.display.focus_window.get_compositor_private();
+                                 this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
                              }));
         panelService.connect('update-preedit-text',
                              Lang.bind(this, function(ps, text, cursorPosition, visible) {
@@ -246,6 +251,12 @@ const CandidatePopup = new Lang.Class({
                              }));
     },
 
+    _setDummyCursorGeometry: function(x, y, w, h) {
+        Main.layoutManager.setDummyCursorGeometry(x, y, w, h);
+        if (this._boxPointer.actor.visible)
+            this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
+    },
+
     _updateVisibility: function() {
         let isVisible = (this._preeditText.visible ||
                          this._auxText.visible ||